package lanou3g.myfirstapp36kr.fragment;

import android.content.Intent;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.View.OnClickListener;

import lanou3g.myfirstapp36kr.R;
import lanou3g.myfirstapp36kr.activity.SearchActivity;
import lanou3g.myfirstapp36kr.adapter.FragmentMoneyViewPagerAdapter;
import lanou3g.myfirstapp36kr.base.BaseFragment;

/**
 * Created by dllo on 16/8/2.
 */
public class FragmentMoney extends BaseFragment {
    private ViewPager viewPager;
    private TabLayout tabLayout;
    @Override
    protected int getLayout()
    {
        return R.layout.fragment_money;
    }

    @Override
    protected void initView(View view) {
        viewPager = (ViewPager) view.findViewById(R.id.view_pager_money);
        tabLayout = (TabLayout) view.findViewById(R.id.tablayout_money);



    }

    @Override
    protected void initData() {
        getActivity().findViewById(R.id.iv_search_money).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(FragmentMoney.this.getActivity(), SearchActivity.class);
                startActivity(intent);
            }
        });
        FragmentMoneyViewPagerAdapter adapter = new FragmentMoneyViewPagerAdapter(getChildFragmentManager());
        viewPager.setAdapter(adapter);
        tabLayout.setupWithViewPager(viewPager);

    }
}
